package org.lagou.resultsethandler;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.dbutils.ResultSetHandler;
import org.lagou.bean.GetResumeBean;
import org.lagou.bean.ResumeBean;

public class GetResumeBeanResultSetHandler implements ResultSetHandler<List<GetResumeBean>> {

	@Override
	public List<GetResumeBean> handle(ResultSet rs) throws SQLException {
		List<GetResumeBean> list = new ArrayList<GetResumeBean>();

		while (rs.next()) {
			GetResumeBean info = new GetResumeBean();
			info.setId(rs.getInt("id"));
			info.setCompanyid(rs.getInt("companyid"));
			info.setPositionid(rs.getInt("positionid"));
			info.setResumeid(rs.getInt("resumeid"));
			info.setState(rs.getInt("state"));
			info.setDate(rs.getString("date"));
			info.setCompanyname(rs.getString("companyname"));
			info.setPositionname(rs.getString("positionname"));
			info.setUserid(rs.getInt("userid"));
			
			ResumeBean rinfo=new ResumeBean(rs.getString("resumename"), rs.getString("name"),rs.getString("sex"), rs.getString("education"), rs.getString("edexperience"), rs.getString("img"), rs.getString("city"), rs.getString("oldcompany"), rs.getString("oldposition"), rs.getString("school"), rs.getString("tel"),rs.getString("email"));
			info.setRinfo(rinfo);
			
			list.add(info);
		}
		return list;
	}

}
